package com.zygh.policeasset.service;

import com.zygh.policeasset.component.CommonResult;
import com.zygh.policeasset.mapper.BusinessProcessMapper;
import com.zygh.policeasset.pojo.BusinessProcess;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BusinessProcessService {
    @Autowired
    BusinessProcessMapper businessProcessMapper;

    public BusinessProcess queryById(Integer id) {
        return this.businessProcessMapper.queryById(id);
    }

    public List<BusinessProcess> queryAll(Integer businessProcessMain) {
        return this.businessProcessMapper.queryAll(businessProcessMain);
    }

    public CommonResult insert(BusinessProcess businessProcess) {
        if (this.businessProcessMapper.insert(businessProcess) > 0) {
            return new CommonResult().success();
        }
        return new CommonResult().validateFailed("添加失败");
    }

    public CommonResult deleteById(Integer id) {
        if (this.businessProcessMapper.deleteById(id) > 0) {
            return new CommonResult().success();
        }
        return new CommonResult().validateFailed("删除失败");
    }

    public CommonResult update(BusinessProcess businessProcess) {
        if (this.businessProcessMapper.update(businessProcess) > 0) {
            return new CommonResult().success();
        }
        return new CommonResult().validateFailed("修改失败");
    }
}